#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
	int x=0;bool f=0;char ch=getchar();
	while(ch<'0'||ch>'9')f^=(ch=='-'),ch=getchar();
	while('0'<=ch&&ch<='9')x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int Maxn=5e5+5;
int n;
struct node{int op,k,F,T,B;}b[Maxn];
int vis[Maxn],cnt;
double val[Maxn],res[Maxn];
signed main(){
	freopen("love.in","r",stdin);
	freopen("love.out","w",stdout);
//	ios::sync_with_stdio(0);
//	cin.tie(0);cout.tie(0);
	n=read();int pdsub1=1;
	for(int i=1;i<=n;i++){
		b[i].op=read();
		if(b[i].op==1){
			b[i]={b[i].op,0,read(),read(),read()};
			vis[++cnt]=i;
			val[i]=(b[i].B+b[i].F*b[i].T)/1.0/b[i].T;
			res[i]=0.0;
			for(int j=1;j<=i;j++){
				if(b[j].op==2||b[j].k==-1)continue;
				res[i]+=abs(1.0*b[j].B+b[j].F*b[j].T-1.0*val[i]*b[j].T);
				if(i!=j)res[j]+=abs(1.0*b[i].B+b[i].F*b[i].T-1.0*val[j]*b[i].T);
			}
		}
		else{
			b[i]={b[i].op,read(),0,0,0};
			for(int j=1;j<=i;j++){
				if(b[j].op==2||b[j].k==-1)continue;
				res[j]-=abs(1.0*b[vis[b[i].k]].B+b[vis[b[i].k]].F*b[vis[b[i].k]].T-1.0*val[j]*b[vis[b[i].k]].T);
			}
			res[vis[b[i].k]]=0.0;
			b[vis[b[i].k]].k=-1;
		}double ans=1e36;
		for(int j=1;j<=i;j++){
			if(b[j].op==2||b[j].k==-1)continue;
			ans=min(ans,res[j]);
//			printf("%.6lf\n",res[j]);
		}printf("%.6lf\n",ans);
	}
	return 0;
}

